package org.testis.gui.mvc.model.testdesign;

import org.testis.gui.mvc.model.*;
import org.testis.gui.mvc.controller.testdesign.TestPlanController;

/**
 *
 * @author Cahit Emir Erel
 */
public class TestPlanModel extends AbstractModel {

    private Boolean m_testPlanVisibility = false;
    private Integer m_timeout = 0;
    private Integer m_browserSpeed = 0;
    private String m_name = "";
    private String m_description = "";
    private String m_browserType = "";
    private String m_dutIp = "";
    
    private Integer m_pc  = 0;
    private Integer m_dut  = 0;
    private Integer m_languageId = 0;
    private Integer m_profileId = 0;
    private Integer m_testBed = 0;

    public String getName() {
        return m_name;
    }

    public void setName(String name) {
        if (name == null) {
            name = "";
        }
        String oldName = m_name;
        m_name = name;
        firePropertyChange(TestPlanController.CHANGE_NAME,
                oldName,
                name);
    }

    public String getDescription() {
        return m_description;
    }

    public void setDescription(String description) {
        if (description == null) {
            description = "";
        }
        String oldDescription = m_description;
        m_description = description;
        firePropertyChange(TestPlanController.CHANGE_DESCRIPTION,
                oldDescription,
                description);
    }

    public Integer getTimeout() {
        return m_timeout;
    }

    public void setTimeout(Integer timeout) {
        if (timeout == null) {
            return;
        }
        Integer oldTimeout = m_timeout;
        m_timeout = timeout;
        firePropertyChange(TestPlanController.CHANGE_TIMEOUT,
                oldTimeout,
                timeout);
    }

    public Integer getBrowserSpeed() {
        return m_browserSpeed;
    }

    public void setBrowserSpeed(Integer browserSpeed) {
        if (browserSpeed == null) {
            return;
        }
        Integer oldBrowserSpeed = m_browserSpeed;
        m_browserSpeed = browserSpeed;
        firePropertyChange(TestPlanController.CHANGE_BROWSER_SPEED,
                oldBrowserSpeed,
                browserSpeed);
    }

    public String getBrowserType() {
        return m_browserType;
    }

    public void setBrowserType(String browserType) {

        if (browserType == null) {
            browserType = "";
        }
        String oldBrowserType = m_browserType;
        m_browserType = browserType;
        firePropertyChange(TestPlanController.CHANGE_BROWSER_TYPE,
                oldBrowserType,
                browserType);
    }

    public Integer getDut() {
        return m_dut;
    }

    public void setDut(Integer dut) {
        if (dut == null) {
            dut =0;
        }
        Integer oldDut = m_dut;
        m_dut = dut;
        firePropertyChange(TestPlanController.CHANGE_DUT,
                oldDut,
                dut);
    }

    public void setTestPlanVisibility(Boolean testPlanVisibility) {
        if (testPlanVisibility == null) {
            return;
        }
        Boolean oldTestPlanVisibility = m_testPlanVisibility;
        m_testPlanVisibility = testPlanVisibility;
        firePropertyChange(TestPlanController.SHOW_ADD_TEST_PLAN,
                oldTestPlanVisibility,
                testPlanVisibility);
    }

    public Boolean getTestPlanVisibility() {
        return m_testPlanVisibility;
    }

    public String getDutIp() {
        return m_dutIp;
    }

    public void setDutIp(String dutIp) {
        if (dutIp == null) {
            dutIp = "";
        }
        String oldDutIp = m_dutIp;
        m_dutIp = dutIp;
        firePropertyChange(TestPlanController.CHANGE_DUT_IP,
                oldDutIp,
                dutIp);
    }

    public Integer getPc() {
        return m_pc;
    }

    public void setPc(Integer pc) {
        if (pc == null) {
            pc = 0;
        }
        Integer oldPc = m_pc;
        m_pc = pc;
        firePropertyChange(TestPlanController.CHANGE_PC,
                oldPc,
                pc);
    }

    public Integer getTestBed() {
        return m_testBed;
    }

    public void setTestBed(Integer testBed) {

        Integer oldValue = m_testBed;
        m_testBed = testBed;
        firePropertyChange(TestPlanController.CHANGE_TEST_BED,
                oldValue,
                m_testBed);
    }

    public Integer getLanguageId() {
        return m_languageId;
    }

    public void setLanguageId(Integer languageId) {

        Integer oldValue = m_languageId;
        m_languageId = languageId;
        firePropertyChange(TestPlanController.CHANGE_LANGUAGE_ID,
                oldValue,
                m_languageId);
    }

    public Integer getProfileId() {
        return m_profileId;
    }

    public void setProfileId(Integer val) {

        Integer oldValue = m_profileId;
        m_profileId = val;
        firePropertyChange(TestPlanController.CHANGE_PROFILE_ID,
                oldValue,
                m_profileId);
    }
}
